﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.MultiTenancy;

namespace Himp.Platform.Dc
{
    /// <summary>
    /// 患者主索引
    /// </summary>
    [Table("PATN_MASTER_IDX")]
    public class PatnMasterIdx : AuditedAggregateRoot<Guid>, IMultiTenant
    {
        #region 属性

        /// <summary>
        /// 患者id
        /// </summary>
        [Column("PATN_ID")]
        public string PatnId { get; set; }

        /// <summary>
        /// 身份证号
        /// </summary>
        [Column("IDCARD")]
        public string Idcard { get; set; }

        /// <summary>
        /// 人员姓名
        /// </summary>
        [Column("NAME")]
        public string Name { get; private set; }

        /// <summary>
        /// 性别 1男 2女
        /// </summary>
        [Column("GEND")]
        public EnumGend Gend { get; private set; }

        /// <summary>
        /// 出生日期
        /// </summary>
        [Column("BRDY")]
        public string Brdy { get; private set; }

        /// <summary>
        /// 民族代码
        /// </summary>
        [Column("NATY_CODE")]
        public string NatyCode { get; private set; }

        /// <summary>
        /// 民族名称
        /// </summary>
        [Column("NATY_NAME")]
        public string NatyName { get; private set; }

        /// <summary>
        /// 患者主索引对应门诊号
        /// </summary>
        public List<PatnMasterIdxAssocOtpNo> PatnMasterIdxAssocOtpNos { get; set; }

        /// <summary>
        /// 患者主索引对应住院号
        /// </summary>
        public List<PatnMasterIdxAssocIptNo> PatnMasterIdxAssocIptNos { get; set; }

        /// <summary>
        /// 患者基本信息
        /// </summary>
        public PatnBaseInfo PatnBaseInfo { get; set; }

        /// <summary>
        /// 患者就诊信息
        /// </summary>
        public List<PatnMdtrtInfo> PatnMdtrtInfos { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public Guid? TenantId { get; set; }

        #endregion

        #region 方法

        private PatnMasterIdx()
        { 
        
        }

        /// <summary>
        /// 新建患者基本信息
        /// </summary>
        internal PatnMasterIdx(string patnId, string psnName,  string idcard
            , EnumGend gend, string brdy, string natyCode, string natyName)
        {
            PatnId = patnId;
            Name = psnName;
            Idcard = idcard;
            Gend = gend;
            Brdy = brdy;
            NatyCode = natyCode;
            NatyName = natyName;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="psnName"></param>
        /// <returns></returns>
        internal PatnMasterIdx ChangePsnName(string psnName)
        {
            Name = psnName;
            return this;
        }

        internal PatnMasterIdx ChangePsnCert(string idcard)
        {
            Idcard = idcard;
            return this;
        }

        #endregion
    }
}
